
  <% if @return_authorization.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@return_authorization.errors.count, "error") %> prohibited this return_authorization from being saved:</h2>

      <ul>
      <% @return_authorization.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :amount %>
    <%= f.text_field :amount %>
  </div>
  <div class="field">
    <%= f.label :restocking_fee %>
    <%= f.text_field :restocking_fee %>
  </div>


  <div id="return_items" class=''>
    <% @order.order_items.each do |item| %>
      <div  id='image_<%= item.id %>'
            class="variant_form left last">
        <% return_item = @return_authorization.return_items.detect {|p| p.order_item_id == item.id } %>
        <% return_item = return_item || ReturnItem.new( order_item: item) %>
        <% return_item.updated_by = current_user.id %>
        <%= f.fields_for :return_items, return_item do |item_form|%>
          <%= render partial: 'item', locals: { :item_form    => item_form,
                                                :return_item  => return_item,
                                                :order_item   => item } %>
          <%= item_form.hidden_field :updated_by %>
        <% end %>
      </div>
    <% end %>
  </div>

    <%= f.hidden_field :user_id %>
    <%= f.hidden_field :created_by %>

  <div class='column float-left'>
    <%= f.fields_for :comments do |comment_form|%>
      <%= comment_form.hidden_field :user_id %>
      <%= comment_form.hidden_field :created_by %>
    <div class="field ">
      <%= comment_form.label :note %><br />
      <%= comment_form.text_area :note, :class => ' height-40' %>
    </div>
    <% end %>
  </div>

  <div class="actions float-right row">
    <%= f.submit 'Submit', class: 'button' %>
  </div>
